<?php
error_reporting(0);
header("Content-type: text/html; charset=utf-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); 
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); 
header("Cache-Control: no-cache, must-revalidate" ); 
header("Pragma: no-cache" );


//测试
require_once 'include/common.fun.php';
require_once 'include/paipai/config.inc.php';

$apistring = $_GET['api'];
//$format = $_GET['format'];
$pureData = $_GET['pureData'];
$callback = $_GET['callback'];
$sellerUin = $_GET['sellerUin'];
$itemCode = $_GET['itemCode'];
$pageSize = $_GET['pageSize'];
$pageIndex = $_GET['pageIndex'];
$categoryId = $_GET['categoryId'];
$orderType = $_GET['orderType'];
$itemState = $_GET['itemState'];
$outputRule = $_GET['outputRule'];

//API系统参数
/*
	以下系统参数可以免登陆
	若WEB或者CLIENT登陆了，以下参数可以省去
*/
$paipaiParamArr = array(
	'uin' => PAIPAI_API_UIN,
	'token' => PAIPAI_API_TOKEN,
	'spid' => PAIPAI_API_SPID,
);

//API用户参数
$userParamArr = array(
	'charset' => 'utf-8',
	'format' => 'xml',
	'sellerUin' => PAIPAI_API_UIN,			  
	'pageIndex' => 1,
	'pageSize' => 10,
	//'format' => $format,
	'pureData' => $pureData,
	'callback' => $callback,
	'sellerUin' => $sellerUin,
	'itemCode' => $itemCode,
	'pageSize' => $pageSize,
	'pageIndex' => $pageIndex,
	'categoryId' => $categoryId,
	'orderType' => $orderType,
	'itemState' => $itemState,
	'outputRule' => $outputRule,
);

//总参数数组
$paramArr = $paipaiParamArr + $userParamArr;

//请求数据
//$result = Util::getResult($paramArr,'/deal/sellerSearchDealList.xhtml');
$result = Util::getResult($paramArr,$apistring);

//解析xml结果
$result = Util::getXmlData($result);

//var_export($result);
echo json_encode($result);

?>
